home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Include / d3dx9core.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-28  |  23.2 KB  |  748 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx9core.h
  6. //  Content:    D3DX core types and functions
  7. //
  8. ///////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx9.h"
  11.  
  12. #ifndef __D3DX9CORE_H__
  13. #define __D3DX9CORE_H__
  14.  
  15.  
  16. ///////////////////////////////////////////////////////////////////////////
  17. // D3DX_SDK_VERSION:
  18. // -----------------
  19. // This identifier is passed to D3DXCheckVersion in order to ensure that an
  20. // application was built against the correct header files and lib files. 
  21. // This number is incremented whenever a header (or other) change would 
  22. // require applications to be rebuilt. If the version doesn't match, 
  23. // D3DXCreateVersion will return FALSE. (The number itself has no meaning.)
  24. ///////////////////////////////////////////////////////////////////////////
  25.  
  26. #define D3DX_VERSION 0x0902
  27. #define D3DX_SDK_VERSION 22
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif //__cplusplus
  32.  
  33. BOOL WINAPI
  34.     D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion);
  35.  
  36. #ifdef __cplusplus
  37. }
  38. #endif //__cplusplus
  39.  
  40.  
  41. ///////////////////////////////////////////////////////////////////////////
  42. // D3DXDebugMute
  43. //    Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute)
  44. //
  45. //  returns previous mute value
  46. //
  47. ///////////////////////////////////////////////////////////////////////////
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif //__cplusplus
  52.  
  53. BOOL WINAPI
  54.     D3DXDebugMute(BOOL Mute);  
  55.  
  56. #ifdef __cplusplus
  57. }
  58. #endif //__cplusplus
  59.  
  60.  
  61. ///////////////////////////////////////////////////////////////////////////
  62. // D3DXGetDriverLevel:
  63. //    Returns driver version information:
  64. //
  65. //    700 - DX7 level driver
  66. //    800 - DX8 level driver
  67. //    900 - DX9 level driver
  68. ///////////////////////////////////////////////////////////////////////////
  69.  
  70. #ifdef __cplusplus
  71. extern "C" {
  72. #endif //__cplusplus
  73.  
  74. UINT WINAPI
  75.     D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice);
  76.  
  77. #ifdef __cplusplus
  78. }
  79. #endif //__cplusplus
  80.  
  81.  
  82. ///////////////////////////////////////////////////////////////////////////
  83. // ID3DXBuffer:
  84. // ------------
  85. // The buffer object is used by D3DX to return arbitrary size data.
  86. //
  87. // GetBufferPointer -
  88. //    Returns a pointer to the beginning of the buffer.
  89. //
  90. // GetBufferSize -
  91. //    Returns the size of the buffer, in bytes.
  92. ///////////////////////////////////////////////////////////////////////////
  93.  
  94. typedef interface ID3DXBuffer ID3DXBuffer;
  95. typedef interface ID3DXBuffer *LPD3DXBUFFER;
  96.  
  97. // {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
  98. DEFINE_GUID(IID_ID3DXBuffer, 
  99. 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
  100.  
  101. #undef INTERFACE
  102. #define INTERFACE ID3DXBuffer
  103.  
  104. DECLARE_INTERFACE_(ID3DXBuffer, IUnknown)
  105. {
  106.     // IUnknown
  107.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  108.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  109.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  110.  
  111.     // ID3DXBuffer
  112.     STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
  113.     STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
  114. };
  115.  
  116.  
  117.  
  118. //////////////////////////////////////////////////////////////////////////////
  119. // D3DXSPRITE flags:
  120. // -----------------
  121. // D3DXSPRITE_DONOTSAVESTATE
  122. //   Specifies device state is not to be saved and restored in Begin/End.
  123. // D3DXSPRITE_DONOTMODIFY_RENDERSTATE
  124. //   Specifies device render state is not to be changed in Begin.  The device
  125. //   is assumed to be in a valid state to draw vertices containing POSITION0, 
  126. //   TEXCOORD0, and COLOR0 data.
  127. // D3DXSPRITE_OBJECTSPACE
  128. //   The WORLD, VIEW, and PROJECTION transforms are NOT modified.  The 
  129. //   transforms currently set to the device are used to transform the sprites 
  130. //   when the batch is drawn (at Flush or End).  If this is not specified, 
  131. //   WORLD, VIEW, and PROJECTION transforms are modified so that sprites are 
  132. //   drawn in screenspace coordinates.
  133. // D3DXSPRITE_BILLBOARD
  134. //   Rotates each sprite about its center so that it is facing the viewer.
  135. // D3DXSPRITE_ALPHABLEND
  136. //   Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0).
  137. //   ID3DXFont expects this to be set when drawing text.
  138. // D3DXSPRITE_SORT_TEXTURE
  139. //   Sprites are sorted by texture prior to drawing.  This is recommended when
  140. //   drawing non-overlapping sprites of uniform depth.  For example, drawing
  141. //   screen-aligned text with ID3DXFont.
  142. // D3DXSPRITE_SORT_DEPTH_FRONTTOBACK
  143. //   Sprites are sorted by depth front-to-back prior to drawing.  This is 
  144. //   recommended when drawing opaque sprites of varying depths.
  145. // D3DXSPRITE_SORT_DEPTH_BACKTOFRONT
  146. //   Sprites are sorted by depth back-to-front prior to drawing.  This is 
  147. //   recommended when drawing transparent sprites of varying depths.
  148. //////////////////////////////////////////////////////////////////////////////
  149.  
  150. #define D3DXSPRITE_DONOTSAVESTATE               (1 << 0)
  151. #define D3DXSPRITE_DONOTMODIFY_RENDERSTATE      (1 << 1)
  152. #define D3DXSPRITE_OBJECTSPACE                  (1 << 2)
  153. #define D3DXSPRITE_BILLBOARD                    (1 << 3)
  154. #define D3DXSPRITE_ALPHABLEND                   (1 << 4)
  155. #define D3DXSPRITE_SORT_TEXTURE                 (1 << 5)
  156. #define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK       (1 << 6)
  157. #define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT       (1 << 7)
  158.  
  159.  
  160. //////////////////////////////////////////////////////////////////////////////
  161. // ID3DXSprite:
  162. // ------------
  163. // This object intends to provide an easy way to drawing sprites using D3D.
  164. //
  165. // Begin - 
  166. //    Prepares device for drawing sprites.
  167. //
  168. // Draw -
  169. //    Draws a sprite.  Before transformation, the sprite is the size of 
  170. //    SrcRect, with its top-left corner specified by Position.  The color 
  171. //    and alpha channels are modulated by Color.
  172. //
  173. // Flush -
  174. //    Forces all batched sprites to submitted to the device.
  175. //
  176. // End - 
  177. //    Restores device state to how it was when Begin was called.
  178. //
  179. // OnLostDevice, OnResetDevice -
  180. //    Call OnLostDevice() on this object before calling Reset() on the
  181. //    device, so that this object can release any stateblocks and video
  182. //    memory resources.  After Reset(), the call OnResetDevice().
  183. //////////////////////////////////////////////////////////////////////////////
  184.  
  185. typedef interface ID3DXSprite ID3DXSprite;
  186. typedef interface ID3DXSprite *LPD3DXSPRITE;
  187.  
  188.  
  189. // {BA0B762D-7D28-43ec-B9DC-2F84443B0614}
  190. DEFINE_GUID(IID_ID3DXSprite, 
  191. 0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14);
  192.  
  193.  
  194. #undef INTERFACE
  195. #define INTERFACE ID3DXSprite
  196.  
  197. DECLARE_INTERFACE_(ID3DXSprite, IUnknown)
  198. {
  199.     // IUnknown
  200.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  201.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  202.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  203.  
  204.     // ID3DXSprite
  205.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  206.  
  207.     STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE;
  208.     STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE;
  209.  
  210.     STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
  211.     STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
  212.  
  213.     STDMETHOD(Begin)(THIS_ DWORD Flags) PURE;
  214.     STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE;
  215.     STDMETHOD(Flush)(THIS) PURE;
  216.     STDMETHOD(End)(THIS) PURE;
  217.  
  218.     STDMETHOD(OnLostDevice)(THIS) PURE;
  219.     STDMETHOD(OnResetDevice)(THIS) PURE;
  220. };
  221.  
  222.  
  223. #ifdef __cplusplus
  224. extern "C" {
  225. #endif //__cplusplus
  226.  
  227. HRESULT WINAPI 
  228.     D3DXCreateSprite( 
  229.         LPDIRECT3DDEVICE9   pDevice, 
  230.         LPD3DXSPRITE*       ppSprite);
  231.  
  232. #ifdef __cplusplus
  233. }
  234. #endif //__cplusplus
  235.  
  236.  
  237.  
  238. //////////////////////////////////////////////////////////////////////////////
  239. // ID3DXFont:
  240. // ----------
  241. // Font objects contain the textures and resources needed to render a specific 
  242. // font on a specific device.
  243. //
  244. // GetGlyphData -
  245. //    Returns glyph cache data, for a given glyph.
  246. //
  247. // PreloadCharacters/PreloadGlyphs/PreloadText -
  248. //    Preloads glyphs into the glyph cache textures.
  249. //
  250. // DrawText -
  251. //    Draws formatted text on a D3D device.  Some parameters are 
  252. //    surprisingly similar to those of GDI's DrawText function.  See GDI 
  253. //    documentation for a detailed description of these parameters.
  254. //    If pSprite is NULL, an internal sprite object will be used.
  255. //
  256. // OnLostDevice, OnResetDevice -
  257. //    Call OnLostDevice() on this object before calling Reset() on the
  258. //    device, so that this object can release any stateblocks and video
  259. //    memory resources.  After Reset(), the call OnResetDevice().
  260. //////////////////////////////////////////////////////////////////////////////
  261.  
  262. typedef struct _D3DXFONT_DESCA
  263. {
  264.     INT Height;
  265.     UINT Width;
  266.     UINT Weight;
  267.     UINT MipLevels;
  268.     BOOL Italic;
  269.     BYTE CharSet;
  270.     BYTE OutputPrecision;
  271.     BYTE Quality;
  272.     BYTE PitchAndFamily;
  273.     CHAR FaceName[LF_FACESIZE];
  274.  
  275. } D3DXFONT_DESCA, *LPD3DXFONT_DESCA;
  276.  
  277. typedef struct _D3DXFONT_DESCW
  278. {
  279.     INT Height;
  280.     UINT Width;
  281.     UINT Weight;
  282.     UINT MipLevels;
  283.     BOOL Italic;
  284.     BYTE CharSet;
  285.     BYTE OutputPrecision;
  286.     BYTE Quality;
  287.     BYTE PitchAndFamily;
  288.     WCHAR FaceName[LF_FACESIZE];
  289.  
  290. } D3DXFONT_DESCW, *LPD3DXFONT_DESCW;
  291.  
  292. #ifdef UNICODE
  293. typedef D3DXFONT_DESCW D3DXFONT_DESC;
  294. typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC;
  295. #else
  296. typedef D3DXFONT_DESCA D3DXFONT_DESC;
  297. typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC;
  298. #endif
  299.  
  300.  
  301. typedef interface ID3DXFont ID3DXFont;
  302. typedef interface ID3DXFont *LPD3DXFONT;
  303.  
  304.  
  305. // {D79DBB70-5F21-4d36-BBC2-FF525C213CDC}
  306. DEFINE_GUID(IID_ID3DXFont, 
  307. 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc);
  308.  
  309.  
  310. #undef INTERFACE
  311. #define INTERFACE ID3DXFont
  312.  
  313. DECLARE_INTERFACE_(ID3DXFont, IUnknown)
  314. {
  315.     // IUnknown
  316.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  317.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  318.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  319.  
  320.     // ID3DXFont
  321.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
  322.     STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE;
  323.     STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE;
  324.     STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE;
  325.     STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE;
  326.  
  327.     STDMETHOD_(HDC, GetDC)(THIS) PURE;
  328.     STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE;
  329.  
  330.     STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE;
  331.     STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE;
  332.     STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE;
  333.     STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE;
  334.  
  335.     STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
  336.     STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
  337.  
  338.     STDMETHOD(OnLostDevice)(THIS) PURE;
  339.     STDMETHOD(OnResetDevice)(THIS) PURE;
  340.  
  341. #ifdef __cplusplus
  342. #ifdef UNICODE
  343.     HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); }
  344.     HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); }
  345. #else
  346.     HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); }
  347.     HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); }
  348. #endif
  349. #endif //__cplusplus
  350. };
  351.  
  352. #ifndef GetTextMetrics
  353. #ifdef UNICODE
  354. #define GetTextMetrics GetTextMetricsW
  355. #else
  356. #define GetTextMetrics GetTextMetricsA
  357. #endif
  358. #endif
  359.  
  360. #ifndef DrawText
  361. #ifdef UNICODE
  362. #define DrawText DrawTextW
  363. #else
  364. #define DrawText DrawTextA
  365. #endif
  366. #endif
  367.  
  368.  
  369. #ifdef __cplusplus
  370. extern "C" {
  371. #endif //__cplusplus
  372.  
  373.  
  374. HRESULT WINAPI 
  375.     D3DXCreateFontA(
  376.         LPDIRECT3DDEVICE9       pDevice,  
  377.         INT                     Height,
  378.         UINT                    Width,
  379.         UINT                    Weight,
  380.         UINT                    MipLevels,
  381.         BOOL                    Italic,
  382.         DWORD                   CharSet,
  383.         DWORD                   OutputPrecision,
  384.         DWORD                   Quality,
  385.         DWORD                   PitchAndFamily,
  386.         LPCSTR                  pFaceName,
  387.         LPD3DXFONT*             ppFont);
  388.  
  389. HRESULT WINAPI 
  390.     D3DXCreateFontW(
  391.         LPDIRECT3DDEVICE9       pDevice,  
  392.         INT                     Height,
  393.         UINT                    Width,
  394.         UINT                    Weight,
  395.         UINT                    MipLevels,
  396.         BOOL                    Italic,
  397.         DWORD                   CharSet,
  398.         DWORD                   OutputPrecision,
  399.         DWORD                   Quality,
  400.         DWORD                   PitchAndFamily,
  401.         LPCWSTR                 pFaceName,
  402.         LPD3DXFONT*             ppFont);
  403.  
  404. #ifdef UNICODE
  405. #define D3DXCreateFont D3DXCreateFontW
  406. #else
  407. #define D3DXCreateFont D3DXCreateFontA
  408. #endif
  409.  
  410.  
  411. HRESULT WINAPI 
  412.     D3DXCreateFontIndirectA( 
  413.         LPDIRECT3DDEVICE9       pDevice, 
  414.         CONST D3DXFONT_DESCA*   pDesc, 
  415.         LPD3DXFONT*             ppFont);
  416.  
  417. HRESULT WINAPI 
  418.     D3DXCreateFontIndirectW( 
  419.         LPDIRECT3DDEVICE9       pDevice, 
  420.         CONST D3DXFONT_DESCW*   pDesc, 
  421.         LPD3DXFONT*             ppFont);
  422.  
  423. #ifdef UNICODE
  424. #define D3DXCreateFontIndirect D3DXCreateFontIndirectW
  425. #else
  426. #define D3DXCreateFontIndirect D3DXCreateFontIndirectA
  427. #endif
  428.  
  429.  
  430. #ifdef __cplusplus
  431. }
  432. #endif //__cplusplus
  433.  
  434.  
  435.  
  436. ///////////////////////////////////////////////////////////////////////////
  437. // ID3DXRenderToSurface:
  438. // ---------------------
  439. // This object abstracts rendering to surfaces.  These surfaces do not 
  440. // necessarily need to be render targets.  If they are not, a compatible
  441. // render target is used, and the result copied into surface at end scene.
  442. //
  443. // BeginScene, EndScene -
  444. //    Call BeginScene() and EndScene() at the beginning and ending of your
  445. //    scene.  These calls will setup and restore render targets, viewports, 
  446. //    etc.. 
  447. //
  448. // OnLostDevice, OnResetDevice -
  449. //    Call OnLostDevice() on this object before calling Reset() on the
  450. //    device, so that this object can release any stateblocks and video
  451. //    memory resources.  After Reset(), the call OnResetDevice().
  452. ///////////////////////////////////////////////////////////////////////////
  453.  
  454. typedef struct _D3DXRTS_DESC
  455. {
  456.     UINT                Width;
  457.     UINT                Height;
  458.     D3DFORMAT           Format;
  459.     BOOL                DepthStencil;
  460.     D3DFORMAT           DepthStencilFormat;
  461.  
  462. } D3DXRTS_DESC, *LPD3DXRTS_DESC;
  463.  
  464.  
  465. typedef interface ID3DXRenderToSurface ID3DXRenderToSurface;
  466. typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE;
  467.  
  468.  
  469. // {6985F346-2C3D-43b3-BE8B-DAAE8A03D894}
  470. DEFINE_GUID(IID_ID3DXRenderToSurface, 
  471. 0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94);
  472.  
  473.  
  474. #undef INTERFACE
  475. #define INTERFACE ID3DXRenderToSurface
  476.  
  477. DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown)
  478. {
  479.     // IUnknown
  480.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  481.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  482.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  483.  
  484.     // ID3DXRenderToSurface
  485.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  486.     STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE;
  487.  
  488.     STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE;
  489.     STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE;
  490.  
  491.     STDMETHOD(OnLostDevice)(THIS) PURE;
  492.     STDMETHOD(OnResetDevice)(THIS) PURE;
  493. };
  494.  
  495.  
  496. #ifdef __cplusplus
  497. extern "C" {
  498. #endif //__cplusplus
  499.  
  500. HRESULT WINAPI
  501.     D3DXCreateRenderToSurface(
  502.         LPDIRECT3DDEVICE9       pDevice,
  503.         UINT                    Width,
  504.         UINT                    Height,
  505.         D3DFORMAT               Format,
  506.         BOOL                    DepthStencil,
  507.         D3DFORMAT               DepthStencilFormat,
  508.         LPD3DXRENDERTOSURFACE*  ppRenderToSurface);
  509.  
  510. #ifdef __cplusplus
  511. }
  512. #endif //__cplusplus
  513.  
  514.  
  515.  
  516. ///////////////////////////////////////////////////////////////////////////
  517. // ID3DXRenderToEnvMap:
  518. // --------------------
  519. // This object abstracts rendering to environment maps.  These surfaces 
  520. // do not necessarily need to be render targets.  If they are not, a 
  521. // compatible render target is used, and the result copied into the
  522. // environment map at end scene.
  523. //
  524. // BeginCube, BeginSphere, BeginHemisphere, BeginParabolic -
  525. //    This function initiates the rendering of the environment map.  As
  526. //    parameters, you pass the textures in which will get filled in with
  527. //    the resulting environment map.
  528. //
  529. // Face -
  530. //    Call this function to initiate the drawing of each face.  For each 
  531. //    environment map, you will call this six times.. once for each face 
  532. //    in D3DCUBEMAP_FACES.
  533. //
  534. // End -
  535. //    This will restore all render targets, and if needed compose all the
  536. //    rendered faces into the environment map surfaces.
  537. //
  538. // OnLostDevice, OnResetDevice -
  539. //    Call OnLostDevice() on this object before calling Reset() on the
  540. //    device, so that this object can release any stateblocks and video
  541. //    memory resources.  After Reset(), the call OnResetDevice().
  542. ///////////////////////////////////////////////////////////////////////////
  543.  
  544. typedef struct _D3DXRTE_DESC
  545. {
  546.     UINT        Size;
  547.     UINT        MipLevels;
  548.     D3DFORMAT   Format;
  549.     BOOL        DepthStencil;
  550.     D3DFORMAT   DepthStencilFormat;
  551.  
  552. } D3DXRTE_DESC, *LPD3DXRTE_DESC;
  553.  
  554.  
  555. typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap;
  556. typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap;
  557.  
  558.  
  559. // {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E}
  560. DEFINE_GUID(IID_ID3DXRenderToEnvMap, 
  561. 0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e);
  562.  
  563.  
  564. #undef INTERFACE
  565. #define INTERFACE ID3DXRenderToEnvMap
  566.  
  567. DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown)
  568. {
  569.     // IUnknown
  570.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  571.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  572.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  573.  
  574.     // ID3DXRenderToEnvMap
  575.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  576.     STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE;
  577.  
  578.     STDMETHOD(BeginCube)(THIS_ 
  579.         LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE;
  580.  
  581.     STDMETHOD(BeginSphere)(THIS_
  582.         LPDIRECT3DTEXTURE9 pTex) PURE;
  583.  
  584.     STDMETHOD(BeginHemisphere)(THIS_ 
  585.         LPDIRECT3DTEXTURE9 pTexZPos,
  586.         LPDIRECT3DTEXTURE9 pTexZNeg) PURE;
  587.  
  588.     STDMETHOD(BeginParabolic)(THIS_ 
  589.         LPDIRECT3DTEXTURE9 pTexZPos,
  590.         LPDIRECT3DTEXTURE9 pTexZNeg) PURE;
  591.  
  592.     STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE;
  593.     STDMETHOD(End)(THIS_ DWORD MipFilter) PURE;
  594.  
  595.     STDMETHOD(OnLostDevice)(THIS) PURE;
  596.     STDMETHOD(OnResetDevice)(THIS) PURE;
  597. };
  598.  
  599.  
  600. #ifdef __cplusplus
  601. extern "C" {
  602. #endif //__cplusplus
  603.  
  604. HRESULT WINAPI
  605.     D3DXCreateRenderToEnvMap(
  606.         LPDIRECT3DDEVICE9       pDevice,
  607.         UINT                    Size,
  608.         UINT                    MipLevels,
  609.         D3DFORMAT               Format,
  610.         BOOL                    DepthStencil,
  611.         D3DFORMAT               DepthStencilFormat,
  612.         LPD3DXRenderToEnvMap*   ppRenderToEnvMap);
  613.  
  614. #ifdef __cplusplus
  615. }
  616. #endif //__cplusplus
  617.  
  618.  
  619.  
  620. ///////////////////////////////////////////////////////////////////////////
  621. // ID3DXLine:
  622. // ------------
  623. // This object intends to provide an easy way to draw lines using D3D.
  624. //
  625. // Begin - 
  626. //    Prepares device for drawing lines
  627. //
  628. // Draw -
  629. //    Draws a line strip in screen-space.
  630. //    Input is in the form of a array defining points on the line strip. of D3DXVECTOR2 
  631. //
  632. // DrawTransform -
  633. //    Draws a line in screen-space with a specified input transformation matrix.
  634. //
  635. // End - 
  636. //     Restores device state to how it was when Begin was called.
  637. //
  638. // SetPattern - 
  639. //     Applies a stipple pattern to the line.  Input is one 32-bit
  640. //     DWORD which describes the stipple pattern. 1 is opaque, 0 is
  641. //     transparent.
  642. //
  643. // SetPatternScale - 
  644. //     Stretches the stipple pattern in the u direction.  Input is one
  645. //     floating-point value.  0.0f is no scaling, whereas 1.0f doubles
  646. //     the length of the stipple pattern.
  647. //
  648. // SetWidth - 
  649. //     Specifies the thickness of the line in the v direction.  Input is
  650. //     one floating-point value.
  651. //
  652. // SetAntialias - 
  653. //     Toggles line antialiasing.  Input is a BOOL.
  654. //     TRUE  = Antialiasing on.
  655. //     FALSE = Antialiasing off.
  656. //
  657. // SetGLLines - 
  658. //     Toggles non-antialiased OpenGL line emulation.  Input is a BOOL.
  659. //     TRUE  = OpenGL line emulation on.
  660. //     FALSE = OpenGL line emulation off.
  661. //
  662. // OpenGL line:     Regular line:  
  663. //   *\                *\
  664. //   | \              /  \
  665. //   |  \            *\   \
  666. //   *\  \             \   \
  667. //     \  \             \   \
  668. //      \  *             \   *
  669. //       \ |              \ /
  670. //        \|               *
  671. //         *
  672. //
  673. // OnLostDevice, OnResetDevice -
  674. //    Call OnLostDevice() on this object before calling Reset() on the
  675. //    device, so that this object can release any stateblocks and video
  676. //    memory resources.  After Reset(), the call OnResetDevice().
  677. ///////////////////////////////////////////////////////////////////////////
  678.  
  679.  
  680. typedef interface ID3DXLine ID3DXLine;
  681. typedef interface ID3DXLine *LPD3DXLINE;
  682.  
  683.  
  684. // {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8}
  685. DEFINE_GUID(IID_ID3DXLine, 
  686. 0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8);
  687.  
  688. #undef INTERFACE
  689. #define INTERFACE ID3DXLine
  690.  
  691. DECLARE_INTERFACE_(ID3DXLine, IUnknown)
  692. {
  693.     // IUnknown
  694.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  695.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  696.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  697.  
  698.     // ID3DXLine
  699.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  700.  
  701.     STDMETHOD(Begin)(THIS) PURE;
  702.  
  703.     STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList,
  704.         DWORD dwVertexListCount, D3DCOLOR Color) PURE;
  705.  
  706.     STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList,
  707.         DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform, 
  708.         D3DCOLOR Color) PURE;
  709.  
  710.     STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE;
  711.     STDMETHOD_(DWORD, GetPattern)(THIS) PURE;
  712.  
  713.     STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE;
  714.     STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE;
  715.  
  716.     STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE;
  717.     STDMETHOD_(FLOAT, GetWidth)(THIS) PURE;
  718.  
  719.     STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE;
  720.     STDMETHOD_(BOOL, GetAntialias)(THIS) PURE;
  721.  
  722.     STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE;
  723.     STDMETHOD_(BOOL, GetGLLines)(THIS) PURE;
  724.  
  725.     STDMETHOD(End)(THIS) PURE;
  726.  
  727.     STDMETHOD(OnLostDevice)(THIS) PURE;
  728.     STDMETHOD(OnResetDevice)(THIS) PURE;
  729. };
  730.  
  731.  
  732. #ifdef __cplusplus
  733. extern "C" {
  734. #endif //__cplusplus
  735.  
  736.  
  737. HRESULT WINAPI
  738.     D3DXCreateLine(
  739.         LPDIRECT3DDEVICE9   pDevice,
  740.         LPD3DXLINE*         ppLine);
  741.  
  742. #ifdef __cplusplus
  743. }
  744. #endif //__cplusplus
  745.  
  746. #endif //__D3DX9CORE_H__
  747.  
  748.